package com.shop2cn.iapi.sqoptrade.parameter.enums;

import java.util.Map;

import com.google.common.collect.Maps;

/**
 * Created by huxiao on 2018/1/9.
 * 风控状态枚举
 * 1-未监测初始状态 2-风控监测通过 -1-风控监测未通过
 */
public enum RiskStatusEnum {

	CONTROLLING(1), PASSED(2), NOT_PASSED(-1);

	private static final Map<Integer, RiskStatusEnum> maps = Maps.newHashMap();

	static {
		for (RiskStatusEnum riskStatusEnum : RiskStatusEnum.values()) {
			maps.put(riskStatusEnum.getCode(), riskStatusEnum);
		}
	}

	int code;

	RiskStatusEnum(int code) {
		this.code = code;
	}

	public static RiskStatusEnum findByCode(Integer code) {
		RiskStatusEnum riskStatusEnum = maps.get(code);
		if (null == riskStatusEnum) {
			throw new IllegalArgumentException("RiskStatusEnum not found,code:"
					+ code);
		}
		return riskStatusEnum;
	}

	public int getCode() {
		return code;
	}
}
